<div class="page-add-new-article page-banner-management">
    <div id="content-header">
        <h1><?php echo $this->request->data['Contact']['name'];?></h1>
    </div>
    <div class="container-fluid">

        <div class="row-fluid">
         <div class="span12">
        <?php
            echo $this->Form->create('Contact', array('id' => 'paginate','class'=>'form-horizontal', 'action' => 'edit', 'url' => $this->request->here(false), 'type' => 'file',
                'inputDefaults' => array('label' => false, 'format' => array('before', 'label', 'between', 'input', 'after', 'error'))));

            echo $this->Html->script('ckeditor/ckeditor');
            echo $this->element('toolbar');
        ?>                                    
        
            <?php   
                $fieldsets['name'] = $this->Form->input('name', array(
                    'label' => array('text'=>__d('system','Name'),'class' => 'control-label'),
                    'between' => '<div class="controls">',
                    'div' => array('class' => 'control-group'),
                    'after' => '</div>',                                                                             
                    'type' => 'text'));                
                $fieldsets['email'] = $this->Form->input('email', array(
                    'label' => array('text'=>__d('system','Email'),'class' => 'control-label'),
                    'between' => '<div class="controls">',
                    'div' => array('class' => 'control-group'),
                    'after' => '</div>',                                                                                
                    'type' => 'text')); 
                $fieldsets['title'] = $this->Form->input('title', array(
                    'label' => array('text'=>__d('system','Title'),'class' => 'control-label'),
                    'between' => '<div class="controls">',
                    'div' => array('class' => 'control-group'),
                    'after' => '</div>',                                                                               
                    'type' => 'text')); 
                $fieldsets['content'] = $this->Form->input('content', array(
                    'label' => array('text'=>__d('system','Content'),'class' => 'control-label'),
                    'between' => '<div class="controls">',
                    'div' => array('class' => 'control-group'),
                    'after' => '</div>',
                    'class'=>'ckeditor',                                                                              
                    'type' => 'textarea')); 
                $fieldsets['address'] = $this->Form->input('address', array(
                    'label' => array('text'=>__d('system','Address'),'class' => 'control-label'),
                    'between' => '<div class="controls">',
                    'div' => array('class' => 'control-group'),
                    'after' => '</div>',                                                                                
                    'type' => 'text')); 
                $fieldsets['phone'] = $this->Form->input('phone', array(
                    'label' => array('text'=>__d('system','Phone'),'class' => 'control-label'),
                    'between' => '<div class="controls">',
                    'div' => array('class' => 'control-group'),
                    'after' => '</div>',                                                                                
                    'type' => 'text')); 
                $fieldsets['status'] = $this->Form->input('status', array(
                    'label' => array('text'=>__d('system','Status'),'class' => 'control-label','style'=>array('padding-top: 1px !important;')),
                    'between' => '<div class="controls">',
                    'div' => array('class' => 'control-group'),
                    'after' => '</div>',                                                                                                    
                    'type' => 'checkbox')); 
               $output = "<div class=control-group>";
                $output .= "<span class = lbl-move>Move for Subsite</span>";
                if(!empty($subSiteModify)){
                    foreach($subSiteModify as $k=>$v){         
                        $chk_move = ClassRegistry::init('Node.MoveContact')->find('first',array(
                            'conditions'=>array('MoveContact.contact_id'=>$id,'MoveContact.subsite_id'=>$k)
                        ));                                                                      
                        $output .= "<label for=ContactEnabled class=move-label>";
                        $output .= $v;
                        $output .= "</label>";                 
                        $output .= "<input type=checkbox name=data[Contact][is_move][] class=check_move value='".$k."'";                                            
                        if(!empty($chk_move)){
                            $output .= "checked";    
                        }                        
                        $output .= "/>";                        
                    }
                }
                $output .= "</div>";                                           
                /* $fieldsets['status'] .= $output;  */              
            ?>
            <?php           
                $layout = array(
                    array('name','email'),
                    array('title','content'),
                    array('address','phone'),
                    array('status')               
                );
                $layout = array(
                    array(
                        'Basic setting',
                        $layout,
                    )
                );
                echo $this->Layout->form($layout, $fieldsets);
            ?>        
        
        <?php
            echo $this->Form->hidden('node_type_id');
            echo $this->Form->hidden('Paginate.task', array('id' => 'task', 'value' => ''));
            echo $this->Form->end();
        ?>                                    
    </div>    
</div>
</div>
<style type="text/css">
    .move-label{clear: both;margin-top: 2px !important;padding-left: 35px;}
    .lbl-move{float: left;padding-left: 73px;}
</style>
